
class MyThread extends Thread{
    @Override
    public void run() {
        System.out.println("继承 Thread, 重写 run");
    }
}
class MyRunnable implements Runnable{
    @Override
    public void run() {
        System.out.println("实现 Runnable, 重写 run");
    }
}
public class Test2 {
    public static void main(String[] args) {
        Thread thread=new Thread(){
            @Override
            public void run() {
                System.out.println("继承 Thread, 重写 run, 使用匿名内部类");
            }
        };

        Runnable runnable=new Runnable() {
            @Override
            public void run() {
                System.out.println("实现 Runnable, 重写 run, 使用匿名内部类");
            }
        };


        Thread t1=new Thread(()->{
            System.out.println("使用 lambda 表达式");
        });
    }
}
